<html>
<head><meta charset="utf-8"><title>rustc-chalk integration, take 2 · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html">rustc-chalk integration, take 2</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="181043120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043120">(Nov 18 2019 at 18:39)</a>:</h4>
<p>So <span class="user-mention" data-user-id="116883">@tmandry</span> and I were talking about how to improve the rustc-chalk integration</p>



<a name="181043172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043172">(Nov 18 2019 at 18:40)</a>:</h4>
<p>And we decided to continue here :)</p>



<a name="181043229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043229">(Nov 18 2019 at 18:40)</a>:</h4>
<p>Currently rustc only uses chalk-engine</p>



<a name="181043247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043247">(Nov 18 2019 at 18:40)</a>:</h4>
<p>and it duplicates all the lowering and other logic</p>



<a name="181043315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043315">(Nov 18 2019 at 18:41)</a>:</h4>
<p>I think what we want instead is that rustc uses chalk-solve</p>



<a name="181043326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043326">(Nov 18 2019 at 18:41)</a>:</h4>
<p>(Like rust-analyzer does)</p>



<a name="181043340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043340">(Nov 18 2019 at 18:41)</a>:</h4>
<p>This will mean that we have to implement <a href="http://rust-lang.github.io/chalk/chalk_solve/trait.RustIrDatabase.html" target="_blank" title="http://rust-lang.github.io/chalk/chalk_solve/trait.RustIrDatabase.html">the <code>RustIrDatabase</code> trait</a></p>



<a name="181043433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043433">(Nov 18 2019 at 18:42)</a>:</h4>
<p>We're not going to be be able to do that yet without some work :)</p>



<a name="181043441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043441">(Nov 18 2019 at 18:43)</a>:</h4>
<p>I was hoping to kind of brainstorm out a bit what this work would be</p>



<a name="181043489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043489">(Nov 18 2019 at 18:43)</a>:</h4>
<p>just made a <a href="https://hackmd.io/l7j-H0PeS2SCXTdpp-TQpA" target="_blank" title="https://hackmd.io/l7j-H0PeS2SCXTdpp-TQpA">hackmd document</a> to keep notes</p>



<a name="181043591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043591">(Nov 18 2019 at 18:44)</a>:</h4>
<p>anyway the real challenge then is going to be created little bits of chalk-ir and chalk-rust-ir from Rust's HIR/ty values</p>



<a name="181043627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043627">(Nov 18 2019 at 18:44)</a>:</h4>
<p>I expect to use the <a href="http://rust-lang.github.io/chalk/chalk_ir/family/trait.TypeFamily.html" target="_blank" title="http://rust-lang.github.io/chalk/chalk_ir/family/trait.TypeFamily.html"><code>TypeFamily</code></a> traits (extended with some more stuff...) to try and make that convenient and efficient</p>



<a name="181043693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043693">(Nov 18 2019 at 18:45)</a>:</h4>
<p>to start, I think we need to add the "ids"</p>



<a name="181043753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043753">(Nov 18 2019 at 18:46)</a>:</h4>
<p>e.g., instead of <code>TypeId</code> being hard-coded to be an integer (wrapped around <code>RawId</code>)</p>



<a name="181043763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043763">(Nov 18 2019 at 18:46)</a>:</h4>
<p>this should probably indirect through <code>TypeFamily</code></p>



<a name="181043769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043769">(Nov 18 2019 at 18:46)</a>:</h4>
<p>that would allow us to use <code>DefId</code> in the compiler</p>



<a name="181043811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043811">(Nov 18 2019 at 18:47)</a>:</h4>
<p>(it's interesting to note that I think Chalk can have a richer notion of ids, all of which map to <code>DefId</code> under the hood)</p>



<a name="181043856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043856">(Nov 18 2019 at 18:47)</a>:</h4>
<p>not sure if that'll cause any difficulty, depends if we currently match on the <code>TypeKindId</code> enum for anything besides debug</p>



<a name="181043993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181043993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181043993">(Nov 18 2019 at 18:49)</a>:</h4>
<p>(answer: we do, a bit, so we should add some methods around that)</p>



<a name="181044028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044028">(Nov 18 2019 at 18:49)</a>:</h4>
<p>for example, we have code like this</p>
<div class="codehilite"><pre><span></span><span class="w">            </span><span class="c1">// If this is a `Foo: Send` (or any auto-trait), then add</span>
<span class="w">            </span><span class="c1">// the automatic impls for `Foo`.</span>
<span class="w">            </span><span class="kd">let</span><span class="w"> </span><span class="n">trait_datum</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">db</span><span class="p">.</span><span class="n">trait_datum</span><span class="p">(</span><span class="n">trait_id</span><span class="p">);</span><span class="w"></span>
<span class="w">            </span><span class="k">if</span><span class="w"> </span><span class="n">trait_datum</span><span class="p">.</span><span class="n">is_auto_trait</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="k">match</span><span class="w"> </span><span class="n">trait_ref</span><span class="p">.</span><span class="n">parameters</span><span class="p">[</span><span class="mi">0</span><span class="p">].</span><span class="n">assert_ty_ref</span><span class="p">().</span><span class="n">data</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="n">TyData</span>::<span class="n">Apply</span><span class="p">(</span><span class="n">apply</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                        </span><span class="k">if</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="n">TypeName</span>::<span class="n">TypeKindId</span><span class="p">(</span><span class="n">TypeKindId</span>::<span class="n">StructId</span><span class="p">(</span><span class="n">struct_id</span><span class="p">))</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">apply</span><span class="p">.</span><span class="n">name</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                            </span><span class="n">push_auto_trait_impls</span><span class="p">(</span><span class="n">builder</span><span class="p">,</span><span class="w"> </span><span class="n">trait_id</span><span class="p">,</span><span class="w"> </span><span class="n">struct_id</span><span class="p">);</span><span class="w"></span>
<span class="w">                        </span><span class="p">}</span><span class="w"></span>
<span class="w">                    </span><span class="p">}</span><span class="w"></span>
<span class="w">                    </span><span class="n">TyData</span>::<span class="n">InferenceVar</span><span class="p">(</span><span class="n">_</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                        </span><span class="n">panic</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;auto-traits should flounder if nothing is known&quot;</span><span class="p">)</span><span class="w"></span>
<span class="w">                    </span><span class="p">}</span><span class="w"></span>
<span class="w">                    </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="181044183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044183">(Nov 18 2019 at 18:51)</a>:</h4>
<p>(<span class="user-mention" data-user-id="116883">@tmandry</span>, still here? :)</p>



<a name="181044195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044195">(Nov 18 2019 at 18:51)</a>:</h4>
<p>yep</p>



<a name="181044205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044205">(Nov 18 2019 at 18:51)</a>:</h4>
<p>apart from the above, I think there are some other mappings we want</p>



<a name="181044209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044209">(Nov 18 2019 at 18:51)</a>:</h4>
<p>e.g.</p>



<a name="181044214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044214">(Nov 18 2019 at 18:51)</a>:</h4>
<p><code>Parameter&lt;TF&gt;</code> =&gt; <code>Kind&lt;'tcx&gt;</code> in rustc</p>



<a name="181044225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044225">(Nov 18 2019 at 18:51)</a>:</h4>
<p>similarly, anything with an embedded <code>Vec</code> or <code>Box</code> seems like trouble</p>



<a name="181044311"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044311" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044311">(Nov 18 2019 at 18:52)</a>:</h4>
<p>I am debating just a bit now -- I guess I take that (mildly) back, it might be that it's ok to make vectors for now, and then it's just perf optimization to improve it</p>



<a name="181044344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044344">(Nov 18 2019 at 18:53)</a>:</h4>
<p>well I do think we really want to try and map <code>Parameter&lt;'tcx&gt;</code> to <code>Kind&lt;'tcx&gt;</code>,</p>



<a name="181044361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044361">(Nov 18 2019 at 18:53)</a>:</h4>
<p>and see if we can (therefore) map a vector of substitutions to <code>Substs&lt;'tcx&gt;</code></p>



<a name="181044363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044363">(Nov 18 2019 at 18:53)</a>:</h4>
<p>the reason is</p>



<a name="181044387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044387">(Nov 18 2019 at 18:53)</a>:</h4>
<p>this is what chalk gives <em>back</em> as answers to queries</p>



<a name="181044446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044446">(Nov 18 2019 at 18:54)</a>:</h4>
<p>I'd like it if we (basically) had some (potentially expensive) function that generates "data" from a <code>Ty&lt;'tcx&gt;</code></p>



<a name="181044465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044465">(Nov 18 2019 at 18:54)</a>:</h4>
<p>for those times that we call <code>ty.data()</code></p>



<a name="181044475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044475">(Nov 18 2019 at 18:54)</a>:</h4>
<p>this is basically doing the translation from rustc's representation to chalk's, and we can make that gradually cheaper</p>



<a name="181044485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044485">(Nov 18 2019 at 18:54)</a>:</h4>
<p>but ideally we wouldn't need such a translation on the way back</p>



<a name="181044567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044567">(Nov 18 2019 at 18:55)</a>:</h4>
<p>(along those lines, I see one potential problem with the existing type signatures...)</p>



<a name="181044622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044622">(Nov 18 2019 at 18:56)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">impl</span><span class="w"> </span><span class="n">Ty</span><span class="o">&lt;</span><span class="n">TF</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">data</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="nc">TyData</span><span class="o">&lt;</span><span class="n">TF</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">...</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="181044636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044636">(Nov 18 2019 at 18:56)</a>:</h4>
<p>if, in rustc, we are generating that <code>TyData</code> on the fly...</p>



<a name="181044655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044655">(Nov 18 2019 at 18:56)</a>:</h4>
<p>it's going to be hard to return borrowed data</p>



<a name="181044660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044660">(Nov 18 2019 at 18:56)</a>:</h4>
<p>well</p>



<a name="181044664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044664">(Nov 18 2019 at 18:56)</a>:</h4>
<p>I guess we can allocate it from the arena</p>



<a name="181044672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044672">(Nov 18 2019 at 18:56)</a>:</h4>
<p>i.e., generate it lazilly (and only once)</p>



<a name="181044708"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044708" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044708">(Nov 18 2019 at 18:57)</a>:</h4>
<p>I think I remember now that is what I had in mind</p>



<a name="181044754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044754">(Nov 18 2019 at 18:58)</a>:</h4>
<p>ok, looking a bit deeper</p>



<a name="181044811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044811">(Nov 18 2019 at 18:58)</a>:</h4>
<p>obviously the types in rustc have a <em>lot</em> more variants than their chalk counterparts</p>



<a name="181044827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044827">(Nov 18 2019 at 18:58)</a>:</h4>
<p>but most of them are effectively type names of various kinds</p>



<a name="181044926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181044926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181044926">(Nov 18 2019 at 18:59)</a>:</h4>
<blockquote>
<p>but ideally we wouldn't need such a translation on the way back</p>
</blockquote>
<p>just making sure I follow.. in the converted type, we can just store a <code>Ty&lt;'tcx&gt;</code>that points back to the rustc type, right?</p>



<a name="181045269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181045269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181045269">(Nov 18 2019 at 19:03)</a>:</h4>
<p>assuming everything's stored in an arena with the same lifetime, it should work</p>



<a name="181045410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181045410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181045410">(Nov 18 2019 at 19:04)</a>:</h4>
<p>Sorry, mm,</p>



<a name="181045438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181045438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181045438">(Nov 18 2019 at 19:05)</a>:</h4>
<p>what do you mean by the "converted type"?</p>



<a name="181045611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181045611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181045611">(Nov 18 2019 at 19:06)</a>:</h4>
<p>well, not sure =) <code>Ty</code> is what I was thinking of</p>



<a name="181045667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181045667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181045667">(Nov 18 2019 at 19:07)</a>:</h4>
<p>but we just have to implement things like <code>ty_data()</code></p>



<a name="181045732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181045732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181045732">(Nov 18 2019 at 19:08)</a>:</h4>
<p>and we can pass <code>Ty&lt;'tcx&gt;</code> straight through chalk?</p>



<a name="181045743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181045743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181045743">(Nov 18 2019 at 19:08)</a>:</h4>
<p>yes so</p>



<a name="181045746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181045746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181045746">(Nov 18 2019 at 19:08)</a>:</h4>
<p>if you implemented <code>ty_data</code></p>



<a name="181045757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181045757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181045757">(Nov 18 2019 at 19:08)</a>:</h4>
<p>you convert one type to chalk's representation -- "up to" embedded types</p>



<a name="181045772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181045772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181045772">(Nov 18 2019 at 19:08)</a>:</h4>
<p>i.e., if you have <code>Vec&lt;u32&gt;</code>, that is two <code>Ty&lt;'tcx&gt;</code> values</p>



<a name="181045799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181045799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181045799">(Nov 18 2019 at 19:09)</a>:</h4>
<p>that is, the <code>Vec</code> has a list (in rustc) of substitutions <code>Substs&lt;'tcx&gt;</code></p>



<a name="181045830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181045830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181045830">(Nov 18 2019 at 19:09)</a>:</h4>
<p>in chalk (today) we have a <code>Vec&lt;Parameter&lt;TF&gt;&gt;</code>, and if you dig in a bit more, you'll see that <code>Parameter&lt;TF&gt;</code> embeds a <code>Ty&lt;TF&gt;</code> which is a newtype of  <code>TF::InternedTy</code></p>



<a name="181045929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181045929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181045929">(Nov 18 2019 at 19:10)</a>:</h4>
<p>so the thing that rustc would have to create (if we made no further changes from what we have today) when you invoke <code>ty_data</code> on the <code>Vec&lt;u32&gt;</code> type would be these structures, and it would embed the <code>Ty&lt;'tcx&gt;</code> representing <code>u32</code></p>



<a name="181045937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181045937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181045937">(Nov 18 2019 at 19:10)</a>:</h4>
<p>not sure if that is making sense</p>



<a name="181045963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181045963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181045963">(Nov 18 2019 at 19:10)</a>:</h4>
<p>basically a <code>Ty&lt;TF&gt;</code> maps directly to an interned type in rustc (a <code>Ty&lt;'tcx&gt;</code>)</p>



<a name="181045981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181045981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181045981">(Nov 18 2019 at 19:11)</a>:</h4>
<p>yeah, makes sense now</p>



<a name="181045997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181045997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181045997">(Nov 18 2019 at 19:11)</a>:</h4>
<p>we don't really <em>have</em> to make any further changes I don't thnk</p>



<a name="181046017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046017">(Nov 18 2019 at 19:11)</a>:</h4>
<p>right now chalk gives back (as its answers) a <code>Vec&lt;Parameter&lt;TF&gt;&gt;</code>, and we could construct a <code>Substs&lt;'tcx&gt;</code> from that, with some work</p>



<a name="181046042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046042">(Nov 18 2019 at 19:11)</a>:</h4>
<p>but it seems like it'd be nicer if pushed that <code>Vec</code> into the type family embedding</p>



<a name="181046124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046124">(Nov 18 2019 at 19:12)</a>:</h4>
<p>that said, looking a bit more, I think something we <em>do</em> have to do is to make <code>TypeName</code> generic</p>



<a name="181046150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046150">(Nov 18 2019 at 19:12)</a>:</h4>
<p>I'm actually a bit torn on this</p>



<a name="181046158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046158">(Nov 18 2019 at 19:12)</a>:</h4>
<p>how this should be handled</p>



<a name="181046199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046199">(Nov 18 2019 at 19:13)</a>:</h4>
<p>the other is that <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/enum.TyKind.html" target="_blank" title="https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/enum.TyKind.html"><code>TyKind</code> in rustc has a lot of variants</a></p>



<a name="181046228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046228">(Nov 18 2019 at 19:13)</a>:</h4>
<p>ah, interesting</p>



<a name="181046301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046301">(Nov 18 2019 at 19:14)</a>:</h4>
<p>yeah it's worth just looking at those and seeing how we would convert them to chalk's notion of <a href="http://rust-lang.github.io/chalk/chalk_ir/enum.TyData.html" target="_blank" title="http://rust-lang.github.io/chalk/chalk_ir/enum.TyData.html"><code>TyData</code></a></p>



<a name="181046355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046355">(Nov 18 2019 at 19:14)</a>:</h4>
<p>seems like many of them would end up as <code>ApplicationTy</code></p>



<a name="181046476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046476">(Nov 18 2019 at 19:16)</a>:</h4>
<p>yes the vast majority</p>



<a name="181046483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046483">(Nov 18 2019 at 19:16)</a>:</h4>
<p>the interesting one I hadn't thought about is GeneratorWitness</p>



<a name="181046492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046492">(Nov 18 2019 at 19:16)</a>:</h4>
<p>it is a kind of quantified type</p>



<a name="181046499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046499">(Nov 18 2019 at 19:16)</a>:</h4>
<blockquote>
<p>seems like many of them would end up as <code>ApplicationTy</code></p>
</blockquote>
<p>anyway this is exactly why I was saying that we probably want <code>TypeName</code> to be generic or something</p>



<a name="181046515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046515">(Nov 18 2019 at 19:16)</a>:</h4>
<p>except that, <em>eventually</em>, I'd like that "list" of types to move from rustc into a (shared) type library</p>



<a name="181046532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046532">(Nov 18 2019 at 19:17)</a>:</h4>
<p>that is used by chalk and a (shared) type-checker and (hence) rustc + rust-analyzer</p>



<a name="181046544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046544">(Nov 18 2019 at 19:17)</a>:</h4>
<p>that <em>type-checker</em> probably cares more about these distinctions</p>



<a name="181046565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046565">(Nov 18 2019 at 19:17)</a>:</h4>
<p>in other words, we might want to sort of hard-code the list</p>



<a name="181046578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046578">(Nov 18 2019 at 19:17)</a>:</h4>
<p>into chalk's type-name</p>



<a name="181046581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046581">(Nov 18 2019 at 19:17)</a>:</h4>
<p>but I'm not sure yet</p>



<a name="181046636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046636">(Nov 18 2019 at 19:18)</a>:</h4>
<p>in terms of other interesting things...</p>



<a name="181046650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046650">(Nov 18 2019 at 19:18)</a>:</h4>
<p>it's worth thinking about refactorings we can do in rusc to make life a touch easier</p>



<a name="181046672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046672">(Nov 18 2019 at 19:18)</a>:</h4>
<p><span class="user-mention" data-user-id="116773">@csmoe</span> already did some by changing how Closure/Generator work (they take a plain <code>SubstsRef&lt;'tcx&gt;</code>)</p>



<a name="181046701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046701">(Nov 18 2019 at 19:19)</a>:</h4>
<p>the <code>GeneratorWitness</code> is sort of a pain</p>



<a name="181046735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046735">(Nov 18 2019 at 19:19)</a>:</h4>
<p>although it's really just an <code>exists&lt;'a&gt; { .. .}</code> sort of type</p>



<a name="181046831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046831">(Nov 18 2019 at 19:20)</a>:</h4>
<p>we maybe want to add this to chalk</p>



<a name="181046842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046842">(Nov 18 2019 at 19:20)</a>:</h4>
<p>the other thing i'm pondering is -- types like <code>fn()</code> in rustc are one type</p>



<a name="181046844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046844">(Nov 18 2019 at 19:20)</a>:</h4>
<p>but in chalk they are two</p>



<a name="181046865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046865">(Nov 18 2019 at 19:20)</a>:</h4>
<p>a <code>ForAll</code> paired with an application</p>



<a name="181046968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046968">(Nov 18 2019 at 19:21)</a>:</h4>
<p>How does that matter?</p>



<a name="181046975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181046975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181046975">(Nov 18 2019 at 19:21)</a>:</h4>
<p>well</p>



<a name="181047039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047039">(Nov 18 2019 at 19:22)</a>:</h4>
<p>right now every <code>Ty&lt;TF&gt;</code> (in chalk) and <code>Ty&lt;'tcx&gt;</code> (in rustc) have to have a 1-to-1 correspondence</p>



<a name="181047053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047053">(Nov 18 2019 at 19:22)</a>:</h4>
<p>that said</p>



<a name="181047085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047085">(Nov 18 2019 at 19:22)</a>:</h4>
<p>I think we should just modify chalk a bit here</p>



<a name="181047098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047098">(Nov 18 2019 at 19:23)</a>:</h4>
<p>instead of having <code>QuantifiedTy</code> wrap exactly one type</p>



<a name="181047156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047156">(Nov 18 2019 at 19:23)</a>:</h4>
<p>it should be more like</p>
<div class="codehilite"><pre><span></span><span class="k">struct</span> <span class="nc">QuantifiedType</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">name</span>: <span class="nc">QuantifiedTypeName</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">binders</span>: <span class="kt">usize</span><span class="p">,</span><span class="w"> </span><span class="c1">// number of bound regions</span>
<span class="w">    </span><span class="n">parameters</span>: <span class="nb">Vec</span><span class="o">&lt;</span><span class="n">Parameter</span><span class="o">&lt;</span><span class="n">TF</span><span class="o">&gt;&gt;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="181047210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047210">(Nov 18 2019 at 19:24)</a>:</h4>
<p>really <code>name</code> and <code>binders</code> kind of overlap and could be merged</p>



<a name="181047251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047251">(Nov 18 2019 at 19:24)</a>:</h4>
<p>the <code>name</code> here would encode the various bits of information from the function signature</p>



<a name="181047258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047258">(Nov 18 2019 at 19:24)</a>:</h4>
<p>e.g., ABI etc</p>



<a name="181047272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047272">(Nov 18 2019 at 19:24)</a>:</h4>
<p>and the <code>parameters</code> listing would be the input/output types</p>



<a name="181047322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047322">(Nov 18 2019 at 19:25)</a>:</h4>
<p>it's a sort of genearlization of chalk's type today but same basic idea -- from POV of chalk, two such types are equal if (a) their names are equal and (b) all the parameters are equal, after instantiating the binders appropriately</p>



<a name="181047449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047449">(Nov 18 2019 at 19:27)</a>:</h4>
<p>I'm a bit lost on the <code>fn()</code> stuff -- what the two types represent in chalk, for example</p>



<a name="181047510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047510">(Nov 18 2019 at 19:27)</a>:</h4>
<p>huh yeah, why is there an application in <code>fn()</code>?</p>



<a name="181047694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047694">(Nov 18 2019 at 19:29)</a>:</h4>
<p>(sorry, multiplexing a few threads)</p>



<a name="181047772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047772">(Nov 18 2019 at 19:30)</a>:</h4>
<p>so today in chalk we effectively have</p>



<a name="181047792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047792">(Nov 18 2019 at 19:30)</a>:</h4>
<div class="codehilite"><pre><span></span>T = forall&lt;&#39;a, ..&gt; { T }
</pre></div>



<a name="181047800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047800">(Nov 18 2019 at 19:30)</a>:</h4>
<p>and I am (first) proposing we genearlize this to</p>



<a name="181047817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047817">(Nov 18 2019 at 19:30)</a>:</h4>
<div class="codehilite"><pre><span></span>T = forall&lt;&#39;a, ...&gt; { T... }
</pre></div>



<a name="181047842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047842">(Nov 18 2019 at 19:31)</a>:</h4>
<p>i.e., you quantify over multiple types</p>



<a name="181047846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047846">(Nov 18 2019 at 19:31)</a>:</h4>
<p>and second, then to add just a bit of a name</p>



<a name="181047860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047860">(Nov 18 2019 at 19:31)</a>:</h4>
<p>why? well, basically because it's not hard to do so, and it lets us map directly to rust's types</p>



<a name="181047872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047872">(Nov 18 2019 at 19:31)</a>:</h4>
<p>rust basically doesn't have a "generic <code>forall</code>" type</p>



<a name="181047897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047897">(Nov 18 2019 at 19:32)</a>:</h4>
<p>it has binders that are "connected" to specifiy sorts of types, such as <code>fn</code> types</p>



<a name="181047974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047974">(Nov 18 2019 at 19:32)</a>:</h4>
<p>plausibly we could just change chalk's <code>QuantifiedTy</code> to <code>FnPointer</code></p>



<a name="181047986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181047986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181047986">(Nov 18 2019 at 19:32)</a>:</h4>
<p>since that's really the only thing that uses it</p>



<a name="181048000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048000">(Nov 18 2019 at 19:33)</a>:</h4>
<p>that's effectively what I'm proposing but with more confusing names :)</p>



<a name="181048018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048018">(Nov 18 2019 at 19:33)</a>:</h4>
<p>I guess that's just better</p>



<a name="181048060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048060">(Nov 18 2019 at 19:33)</a>:</h4>
<p>one other thing: chalk uses debruijn indices somewhat differently from rustc</p>



<a name="181048155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048155">(Nov 18 2019 at 19:34)</a>:</h4>
<p>in rustc, a bound variable is identified by a debruijn index (that indentifies the binder) <em>and</em> an internal index (within that binder); in chalk I think we just have the latter. Not sure how much of a pain this will be to reconcile. Probably we should try to adapt one or the other.</p>



<a name="181048219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048219">(Nov 18 2019 at 19:35)</a>:</h4>
<p>one place the difference shows up is exactly <code>fn</code> types --</p>



<a name="181048230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048230">(Nov 18 2019 at 19:35)</a>:</h4>
<p>in rustc they don't have to indicate how many lifetimes they introduce</p>



<a name="181048257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048257">(Nov 18 2019 at 19:35)</a>:</h4>
<p>e.g., <code>for&lt;'a, 'b&gt; fn(&amp;'a &amp;'b u32)</code> in chalk is a <code>QuantifiedTy</code> with <code>num_binders: 2</code></p>



<a name="181048305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048305">(Nov 18 2019 at 19:36)</a>:</h4>
<p>but in rustc we don't know how many such regions are bound unless we walk the types within</p>



<a name="181048350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048350">(Nov 18 2019 at 19:36)</a>:</h4>
<p>not sure if that's good, just true</p>



<a name="181048363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048363">(Nov 18 2019 at 19:36)</a>:</h4>
<blockquote>
<p>plausibly we could just change chalk's <code>QuantifiedTy</code> to <code>FnPointer</code></p>
</blockquote>
<p>does this make sense, <span class="user-mention" data-user-id="116883">@tmandry</span> / <span class="user-mention" data-user-id="125131">@detrumi</span> ?</p>



<a name="181048409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048409">(Nov 18 2019 at 19:37)</a>:</h4>
<p>I think so</p>



<a name="181048410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048410">(Nov 18 2019 at 19:37)</a>:</h4>
<p>hmm</p>



<a name="181048440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048440">(Nov 18 2019 at 19:38)</a>:</h4>
<p>ah, they're both needed to uniquely identify the type, right?</p>



<a name="181048505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048505">(Nov 18 2019 at 19:38)</a>:</h4>
<p>the debruijn index and the internal index</p>



<a name="181048531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048531">(Nov 18 2019 at 19:38)</a>:</h4>
<p>yes, both are needed</p>



<a name="181048562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048562">(Nov 18 2019 at 19:39)</a>:</h4>
<p>..but not in chalk?</p>



<a name="181048572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048572">(Nov 18 2019 at 19:39)</a>:</h4>
<p>well in chalk we have only one set of indices</p>



<a name="181048574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048574">(Nov 18 2019 at 19:39)</a>:</h4>
<p>let me give an example</p>



<a name="181048591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048591">(Nov 18 2019 at 19:39)</a>:</h4>
<p><code>for&lt;'a, 'b&gt; fn (&amp;'a u32, &amp;'b u32)</code> in chalk is like <code>fn(&amp;^1 u32, &amp;^0 u32)</code></p>



<a name="181048602"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048602" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048602">(Nov 18 2019 at 19:39)</a>:</h4>
<p>but in rustc it would be <code>fn(&amp;^0.1 u32, &amp;0.0 u32)</code></p>



<a name="181048651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048651">(Nov 18 2019 at 19:40)</a>:</h4>
<p>where the <code>^x</code> in chalk means "bound value with index <code>x</code>"</p>



<a name="181048666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048666">(Nov 18 2019 at 19:40)</a>:</h4>
<p>and in rustc <code>^x.y</code> means "the <code>y</code>th type bound in binder with index <code>x</code>"</p>



<a name="181048689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048689">(Nov 18 2019 at 19:40)</a>:</h4>
<p>right, and the <code>num_binders</code> in chalk helps you keep track which index belongs to which binder?</p>



<a name="181048698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048698">(Nov 18 2019 at 19:40)</a>:</h4>
<p>in chalk yes</p>



<a name="181048737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048737">(Nov 18 2019 at 19:41)</a>:</h4>
<p>I think there is .. maybe one or two places we take advantage of this? but with the newer clause builder it's hopefully not all that hard to convert</p>



<a name="181048750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048750">(Nov 18 2019 at 19:41)</a>:</h4>
<p>I guess I don't know, I'd have to go look</p>



<a name="181048757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048757">(Nov 18 2019 at 19:41)</a>:</h4>
<p>I do think they should agree, it will make our lives easier</p>



<a name="181048763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048763">(Nov 18 2019 at 19:42)</a>:</h4>
<p>and it seems easier to change chalk than rustc :)</p>



<a name="181048829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048829">(Nov 18 2019 at 19:42)</a>:</h4>
<p>won't it be problematic to not know how many they bind though?</p>



<a name="181048916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048916">(Nov 18 2019 at 19:43)</a>:</h4>
<p>not sure</p>



<a name="181048929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048929">(Nov 18 2019 at 19:43)</a>:</h4>
<p>I mean you can always recover that information</p>



<a name="181048930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181048930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181048930">(Nov 18 2019 at 19:43)</a>:</h4>
<p>by walking the type</p>



<a name="181049001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049001">(Nov 18 2019 at 19:44)</a>:</h4>
<p>I think what rustc tends to do</p>



<a name="181049010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049010">(Nov 18 2019 at 19:44)</a>:</h4>
<p>well, so I think a side-effect -- where chalk tends to have a signature like</p>



<a name="181049026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049026">(Nov 18 2019 at 19:44)</a>:</h4>
<div class="codehilite"><pre><span></span>fn substitute(parameters: &amp;[ Parameter ])
</pre></div>



<a name="181049049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049049">(Nov 18 2019 at 19:45)</a>:</h4>
<p>in rustc, you instead have to have a closure that (lazilly) computes the value for a given bound thing</p>



<a name="181049059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049059">(Nov 18 2019 at 19:45)</a>:</h4>
<p>since you usually don't know how many there are in advance, and so you kind of generate the substitution as you go</p>



<a name="181049088"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049088" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049088">(Nov 18 2019 at 19:45)</a>:</h4>
<p>(there is a helper for this)</p>



<a name="181049102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049102">(Nov 18 2019 at 19:46)</a>:</h4>
<p>it may be that we can interconvert, but it seems like it will be a bit tricky, and require a bit of state to do</p>



<a name="181049199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049199">(Nov 18 2019 at 19:47)</a>:</h4>
<p>basically to create a chalk type from a rustc type, you'd have to know how many items were in each enclosing binder</p>



<a name="181049202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049202">(Nov 18 2019 at 19:47)</a>:</h4>
<p>and rustc doesn't know</p>



<a name="181049255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049255">(Nov 18 2019 at 19:47)</a>:</h4>
<p>I guess the obvious final thing that chalk needs to handle to truly handle rustc is constants</p>



<a name="181049385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049385">(Nov 18 2019 at 19:49)</a>:</h4>
<p>(for array types)</p>



<a name="181049500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049500">(Nov 18 2019 at 19:50)</a>:</h4>
<p>rustc's <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/struct.Const.html" target="_blank" title="https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/struct.Const.html"><code>Const</code></a> you mean?</p>



<a name="181049527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049527">(Nov 18 2019 at 19:50)</a>:</h4>
<p>yes, I mean we have this type in rustc:</p>
<div class="codehilite"><pre><span></span><span class="w">    </span><span class="n">Array</span><span class="p">(</span><span class="n">Ty</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="na">&#39;tcx</span><span class="w"> </span><span class="n">Const</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">),</span><span class="w"></span>
</pre></div>



<a name="181049542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049542">(Nov 18 2019 at 19:50)</a>:</h4>
<p>this is an application type in chalk</p>



<a name="181049549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049549">(Nov 18 2019 at 19:51)</a>:</h4>
<p>but one of the arguments is a <code>Const</code></p>



<a name="181049604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049604">(Nov 18 2019 at 19:51)</a>:</h4>
<p>this is clearly something we just have to add to chalk, a third kind ("constants") -- I dont' think it should be that difficult, but we'll have to experiment a bit to figure out how the interface around that should work (this is also a WIP in rustc)</p>



<a name="181049618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049618">(Nov 18 2019 at 19:52)</a>:</h4>
<p>see also <a href="#narrow/stream/144729-wg-traits/topic/lazy-normalization.20and.20const.20generics" title="#narrow/stream/144729-wg-traits/topic/lazy-normalization.20and.20const.20generics">this topic</a> :) -- where I owe a reply or two...</p>



<a name="181049684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049684">(Nov 18 2019 at 19:52)</a>:</h4>
<p>ok, but I think that's it</p>



<a name="181049692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049692">(Nov 18 2019 at 19:52)</a>:</h4>
<p>it's .. not trivial, but nothing seems that hard to me</p>



<a name="181049718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049718">(Nov 18 2019 at 19:52)</a>:</h4>
<p>I can probably turn the notes in <a href="https://hackmd.io/l7j-H0PeS2SCXTdpp-TQpA?edit" target="_blank" title="https://hackmd.io/l7j-H0PeS2SCXTdpp-TQpA?edit">the hackmd</a> into concrete issues</p>



<a name="181049739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049739">(Nov 18 2019 at 19:53)</a>:</h4>
<p>though I'm a bit torn on the debruijn indices one (though some part of me wants to rip them out from everywhere in favor of "names that never alias")</p>



<a name="181049760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049760">(Nov 18 2019 at 19:53)</a>:</h4>
<p>we didn't look at the chalk-rust-ir adaptations that are needed but that's ok</p>



<a name="181049812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049812">(Nov 18 2019 at 19:54)</a>:</h4>
<p>I think that will be much easier because</p>



<a name="181049819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049819">(Nov 18 2019 at 19:54)</a>:</h4>
<p>there isn't the whole "nesting" side of things</p>



<a name="181049969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049969">(Nov 18 2019 at 19:56)</a>:</h4>
<p>i.e., you generate (say) a chalk <a href="http://rust-lang.github.io/chalk/chalk_rust_ir/struct.StructDatum.html" target="_blank" title="http://rust-lang.github.io/chalk/chalk_rust_ir/struct.StructDatum.html">struct datum</a> from the rustc queries</p>



<a name="181049971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049971">(Nov 18 2019 at 19:56)</a>:</h4>
<p>but we never have to go back etc</p>



<a name="181049977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181049977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181049977">(Nov 18 2019 at 19:56)</a>:</h4>
<p>and they don't embed other things except via def-ids</p>



<a name="181050046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050046">(Nov 18 2019 at 19:57)</a>:</h4>
<p>Well, I have to run to something else, but that was kind of useful, hope it made sense to y'all -- any parting thoughts?</p>



<a name="181050057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050057">(Nov 18 2019 at 19:57)</a>:</h4>
<p>I guess the question is "when/how will this work happen"</p>



<a name="181050062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050062">(Nov 18 2019 at 19:57)</a>:</h4>
<p>I'm happy to try and create some issues, I think a lot of these refactors will be relatively simple, if grungy</p>



<a name="181050134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050134">(Nov 18 2019 at 19:58)</a>:</h4>
<p>(e.g., changing <code>QuantifiedTy</code> to <code>FnPointer</code> shouldn't be especially difficult..?)</p>



<a name="181050191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050191">(Nov 18 2019 at 19:59)</a>:</h4>
<p>was there anything else that needed to be done for fn pointers?</p>



<a name="181050225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050225">(Nov 18 2019 at 19:59)</a>:</h4>
<p>I think that suffices, though we'll have to include some extra info for stuff like ABI</p>



<a name="181050234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050234">(Nov 18 2019 at 19:59)</a>:</h4>
<p>you said they're one type in rustc and two in chalk, not sure how changing the name of <code>QuantifiedTy</code> is going to change that, or if it matters</p>



<a name="181050249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050249">(Nov 18 2019 at 19:59)</a>:</h4>
<p>it's not just changing the name of the type, in other words</p>



<a name="181050323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050323">(Nov 18 2019 at 20:00)</a>:</h4>
<p>it's also making it have a few extra fields and (in particular) take a <code>Vec&lt;Parameter&lt;TF&gt;&gt;</code> instead of a single <code>Ty&lt;TF&gt;</code></p>



<a name="181050349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050349">(Nov 18 2019 at 20:00)</a>:</h4>
<p>ah</p>



<a name="181050381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050381">(Nov 18 2019 at 20:00)</a>:</h4>
<p>I'm still a bit torn on whether it should be called <code>ForAllApply</code> or something or <code>FnPointer</code></p>



<a name="181050385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050385">(Nov 18 2019 at 20:00)</a>:</h4>
<p>the latter seems... a lot more obvious :)</p>



<a name="181050406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050406">(Nov 18 2019 at 20:01)</a>:</h4>
<p>the only argument for the former is that <code>GeneratorWitness</code> is basically <code>ExistsApply</code></p>



<a name="181050411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050411">(Nov 18 2019 at 20:01)</a>:</h4>
<p>hmm that is kind of a decent-ish argument</p>



<a name="181050433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050433">(Nov 18 2019 at 20:01)</a>:</h4>
<p>but it's not a very strong one</p>



<a name="181050448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050448">(Nov 18 2019 at 20:01)</a>:</h4>
<p>sorry, I'm not being very clear</p>



<a name="181050450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050450">(Nov 18 2019 at 20:01)</a>:</h4>
<p>what I mean is</p>



<a name="181050462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050462">(Nov 18 2019 at 20:01)</a>:</h4>
<p>we have <code>Apply</code> types that do not introduce binders</p>



<a name="181050466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050466">(Nov 18 2019 at 20:02)</a>:</h4>
<p>we could have a <code>QuantifiedApply</code> or something that <em>does</em></p>



<a name="181050531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050531">(Nov 18 2019 at 20:02)</a>:</h4>
<p>and (depending on the <code>name</code> field) that might be a <code>fn()</code> type or it might be a generator witness</p>



<a name="181050538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050538">(Nov 18 2019 at 20:02)</a>:</h4>
<p>chalk doesn't really care either way</p>



<a name="181050548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050548">(Nov 18 2019 at 20:02)</a>:</h4>
<p>and neither do most part of the code</p>



<a name="181050556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050556">(Nov 18 2019 at 20:02)</a>:</h4>
<p>anyway it's a (relatively) minor detail</p>



<a name="181050564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050564">(Nov 18 2019 at 20:02)</a>:</h4>
<p>that is clearer, thank you :)</p>



<a name="181050566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050566">(Nov 18 2019 at 20:02)</a>:</h4>
<p>Changing all <code>Apply</code>'s to <code>QuantifiedApply</code> probably is a bad option, right?</p>



<a name="181050574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050574">(Nov 18 2019 at 20:03)</a>:</h4>
<p>yes, bad option</p>



<a name="181050585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050585">(Nov 18 2019 at 20:03)</a>:</h4>
<p>for one thing unifiying applied types is a lot more complex</p>



<a name="181050601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050601">(Nov 18 2019 at 20:03)</a>:</h4>
<p>basically in general the code <em>does</em> care if there are binders</p>



<a name="181050606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050606">(Nov 18 2019 at 20:03)</a>:</h4>
<p>so I think it should be a different variant</p>



<a name="181050858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050858">(Nov 18 2019 at 20:06)</a>:</h4>
<p>It feels like we're suddenly a lot closer to rustc-chalk integration, this was a very productive discussion <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="181050882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050882">(Nov 18 2019 at 20:06)</a>:</h4>
<p>(though I suppose it was in niko's head all along)</p>



<a name="181050927"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050927" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050927">(Nov 18 2019 at 20:07)</a>:</h4>
<p>good to get it out</p>



<a name="181050942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/rustc-chalk%20integration%2C%20take%202/near/181050942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/rustc-chalk.20integration.2C.20take.202.html#181050942">(Nov 18 2019 at 20:07)</a>:</h4>
<p>I'll try to take notes on the next few steps that I've been pondering after this too ...:)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>